/**
 * Created by 李柏霖
 * 2020/10/19 17:36
 */

package com.lbl.service.Impl;


import com.lbl.dao.IDepartmentDao;
import com.lbl.domain.Department;
import com.lbl.service.IDepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DepartmentServiceImpl implements IDepartmentService {



    @Autowired
    IDepartmentDao departmentDao;

    @Override
    public List<Department> findAll() {
        return departmentDao.findAll();
    }

    @Override
    public void save(Department department) {
        departmentDao.save(department);
    }



    @Override
    public void saveDepartments(List<Department> departments) {
        for (int i = 0; i <departments.size() ; i++) {
            departmentDao.save(departments.get(i));
        }

    }

    @Override
    public void deleteById(Integer did) {
        departmentDao.deleteById(did);
    }

    @Override
    public Department findById(Integer did) {
        return departmentDao.findById(did);
    }

    @Override
    public void update(Department department) {
        departmentDao.update(department);
    }
}
